<?php 

	/**
	* 
	*/
	class Code
	{	
		public $width;

		public $height;

		public $length;

		public $line;

		public $point;

		public $src;

		public $fontsize;
		
		public function show($width=300,$height=200,$length=4,$line=20,$point=300,$fontsize=50)
		{	
			$this->width=$width;
			$this->height=$height;
			$this->length=$length;
			$this->line=$line;
			$this->point=$point;
			$this->fontsize=$fontsize;
			$this->canvas();
			$this->line();
			$this->point();
			$this->output();

		}
		public function canvas()
		{
			$this->src = imageCreateTrueColor($this->width,$this->height);

			$color = imageColorAllocate($this->src,0,0,0); 

			imageFill($this->src,0,0,$color);

			for ($i=0; $i < $this->length; $i++) { 
				$font = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM";

				$code = $font[mt_rand(0,strlen($font)-1)];

				$width1 = $i*70;

				$width1 += 20;

				$height1 = mt_rand(110,115);

				$color = imageColorAllocate($this->src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255)); 

				imagettftext($this->src,$this->fontsize,mt_rand(-10,10), $width1 , $height1 , $color , "./Kiddy Paints.ttf" , $code);
			}
		}
		public function line()
		{
			
			for ($i=0; $i < $this->line ; $i++) { 

				$color = imageColorAllocate($this->src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255)); 

				imageline ( $this->src , mt_rand(0,300) , mt_rand(0,100) , mt_rand(0,300) , mt_rand(100,200) , $color );
			};
		}
		public function point()
		{
			for ($i=0; $i < $this->point ; $i++) { 

			$color = imageColorAllocate($this->src,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255)); 

			imagesetpixel ( $this->src , mt_rand(0,300) , mt_rand(0,200) , $color );

			}
		}
		public function output()
		{
			imagejpeg($this->src); 
		}
	}
















 ?>